"""
给定一个文章，找出每个单词的出现次数。例如给定下面的一篇短文，进行操作。
One is always on a strange road, watching strange scenery and listening to strange music.
Then one day, you will find that the things you try hard to forget are already gone.
"""

paper = '''One is always on a strange road, watching strange scenery and listening to strange music.
Then one day,you will find that the things you try hard to forget are already gone.
'''
paper = paper.replace(',', ' ').replace('.', ' ')  # 空格替换标点
paper = paper.split()  # spilt函数切割句子
paper1 = set(paper)  # 建立集合，便于计数
for word in paper1:
    num = paper.count(word)
    print(f'{word} 出现次数是 {num} 次')


